home *** CD-ROM | disk | FTP | other *** search
- var prevX = this._x;
- var prevY = this._y;
- var speed = 7;
- var hit = false;
- var block = false;
- onEnterFrame = function()
- {
- if(_visible)
- {
- if(_root.userCar != "")
- {
- _root.userCar = "";
- }
- if(!hit)
- {
- prevX = this._x;
- prevY = this._y;
- if(Key.isDown(37) && !Key.isDown(39))
- {
- target_mc.gotoAndPlay(2);
- _X = _X - speed;
- _rotation = 90;
- }
- if(Key.isDown(39) && !Key.isDown(37))
- {
- target_mc.gotoAndPlay(2);
- _X = _X + speed;
- _rotation = 270;
- }
- if(Key.isDown(38) && !Key.isDown(40))
- {
- target_mc.gotoAndPlay(2);
- _Y = _Y - speed;
- _rotation = 180;
- }
- if(Key.isDown(40) && !Key.isDown(38))
- {
- target_mc.gotoAndPlay(2);
- _Y = _Y + speed;
- _rotation = 0;
- }
- if(Key.isDown(37) && Key.isDown(38) && !Key.isDown(39) && !Key.isDown(40))
- {
- target_mc.gotoAndPlay(2);
- _X = _X + speed / 4;
- _Y = _Y + speed / 4;
- _rotation = 135;
- }
- if(Key.isDown(39) && Key.isDown(38) && !Key.isDown(37) && !Key.isDown(40))
- {
- target_mc.gotoAndPlay(2);
- _X = _X - speed / 4;
- _Y = _Y + speed / 4;
- _rotation = 225;
- }
- if(Key.isDown(37) && Key.isDown(40) && !Key.isDown(39) && !Key.isDown(38))
- {
- target_mc.gotoAndPlay(2);
- _X = _X + speed / 4;
- _Y = _Y - speed / 4;
- _rotation = 45;
- }
- if(Key.isDown(39) && Key.isDown(40) && !Key.isDown(37) && !Key.isDown(38))
- {
- target_mc.gotoAndPlay(2);
- _X = _X - speed / 4;
- _Y = _Y - speed / 4;
- _rotation = 315;
- }
- }
- else
- {
- this._x = prevX;
- this._y = prevY;
- hit = false;
- }
- }
- };
-